package com.sheepone.util.time.getter;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

/**
 * @author Miss.杨
 * @description
 * @since 2025/3/13 - 21:17
 */
public class TimeStampGetter {
    private TimeStampGetter() {
    }

    public static long millis() {
        return System.currentTimeMillis();
    }

    public static long nanos() {
        return nanos(Instant.now());
    }

    public static long nanos(Instant time) {
        return time.toEpochMilli() * 1000_000 + time.getNano();
    }

    public static long seconds(LocalDateTime localDateTime) {
        return seconds(localDateTime.atZone(ZoneOffset.UTC).toInstant());
    }

    public static long seconds() {
        return seconds(Instant.now());
    }

    public static long seconds(Instant instant) {
        return instant.getEpochSecond();
    }
}
